// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic',
  //'appItf.service',edit_by_wenh_2016_3_22 使用最新的aop接口
  'appItfAop.service',
  'ddcx.controller','ddcx.service',//订单查询
  'ddfd.controller','ddfd.service',//订单返档
  'gywm.controller','gywm.service',//关于我们
  'login.controller','login.service',//登录
  'maincontent.controller','maincontent.service',//主页面
  'yhzx.controller','yhzx.service',//用户中心
  'ywkh.controller','ywkh.service',//移网开户
  'zhjf.controller','zhjf.service',//综合缴费
  'bluetoothoptions.controller','bluetoothoptions.service',//蓝牙设置
  'zdchbd.controller','zdchbd.service',//终端串号绑定
  'gwysl.controller','gwysl.service',//固网预受理
  'xyrhyddlr.controller','xyrhyddlr.service',//校园融合预订单录入
  'xyrhyddcx.controller','xyrhyddcx.service',//校园融合预订单查询
  'rzbd.controller','rzbd.service',//校园融合预订单查询
  'ngCordova',//ncCordova
  'ionic.utils'//存储本地变量
])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    if(window.cordova && window.cordova.plugins.Keyboard) {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

      // Don't remove this line unless you know what you are doing. It stops the viewport
      // from snapping when text inputs are focused. Ionic handles this internally for
      // a much nicer keyboard experience.
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });



})
/**
 * 路由配置
 */
  .config(function($stateProvider,$urlRouterProvider){

    $stateProvider
      .state('login',{
        url:'/login',
        templateUrl:'templates/login.html',
       controller:'loginCtrl'
      })
      .state('maincontent',{
        url:'/maincontent',
        templateUrl:'templates/maincontent.html',
        controller:'mainContentCtrl'
      })
      .state('ywkh',{
        url:'/ywkh',
        templateUrl:'templates/ywkh/step1.html',
        controller:'ywkhCtrl'
      })
      .state('ywkh/step2',{
          url:'/ywkh/step2',
          templateUrl:'templates/ywkh/step2.html',
          controller:'ywkhCtrl'
        })
      .state('ywkh/step3',{
         url:'/ywkh/step3',
         templateUrl:'templates/ywkh/step3.html',
         controller:'ywkhCtrl'
       })
      .state('ywkh/step3_1',{
        url:'/ywkh/step3_1',
        templateUrl:'templates/ywkh/step3_1.html',
        controller:'ywkhCtrl'
      })
      .state('ywkh/step3_2',{
        url:'/ywkh/step3_2',
        templateUrl:'templates/ywkh/step3_2.html',
        controller:'ywkhCtrl'
      })
      .state('ywkh/step4',{
         url:'/ywkh/step4',
         templateUrl:'templates/ywkh/step4.html',
         controller:'ywkhCtrl'
       })
      .state('gwysl/step1',{
        url:'/gwysl/step1',
        templateUrl:'templates/gwysl/step1.html',
        controller:'gwyslCtrl'
      })
      .state('gwysl/step2',{
        url:'/gwysl/step2',
        templateUrl:'templates/gwysl/step2.html',
        controller:'gwyslCtrl'
      })
      .state('gwysl/step3',{
        url:'/gwysl/step3',
        templateUrl:'templates/gwysl/step3.html',
        controller:'gwyslCtrl'
      })
      .state('gwysl/step4',{
        url:'/gwysl/step4',
        templateUrl:'templates/gwysl/step4.html',
        controller:'gwyslCtrl'
      })
      .state('gwysl/step5',{
        url:'/gwysl/step5',
        templateUrl:'templates/gwysl/step5.html',
        controller:'gwyslCtrl'
      })
      .state('ddfd',{//订单返档
        url:'/ddfd',
        templateUrl:'templates/ddfd.html',
        controller:'ddfdCtrl'
      })
      .state('ddcx',{//订单查询
        url:'/ddcx',
        templateUrl:'templates/ddcx.html',
        controller:'ddcxCtrl'
      })
      .state('yhzx',{//用户中心
        url:'/yhzx',
        templateUrl:'templates/yhzx.html',
        controller:'yhzxCtrl'
      })
      .state('zhjf',{//综合缴费
        url:'/zhjf',
        templateUrl:'templates/zhjf.html',
        controller:'zhjfCtrl'
      })
      .state('xyrhyddlr',{//校园融合预订单录入
        url:'/xyrhyddlr',
        templateUrl:'templates/xyrhyddlr.html',
        controller:'xyrhyddlrCtrl'
      })
      .state('xyrhyddcx',{//校园融合预订单查询
        url:'/xyrhyddcx',
        templateUrl:'templates/xyrhyddcx.html',
        controller:'xyrhyddcxCtrl'
      })
      .state('gywm',{//关于我们
        url:'/gywm',
        templateUrl:'templates/gywm.html',
        controller:'gywmCtrl'
      })
      .state('bluetoothoptions', {
        url: '/bluetoothoptions',
        templateUrl: 'templates/bluetoothoptions.html',
        controller: 'blueToothOptionsCtrl'
      })
      //.state('bluetooth-ready', {
      //  url: '/bluetooth/:mac',
      //  templateUrl: 'templates/bluetooth-ready.html',
      //  controller: 'bluetoothDetailCtrl'
      //})
      .state('ddcxdetails', {
        url: '/ddcxdetails',
        templateUrl: 'templates/ddcxdetails.html',
        controller: 'ddcxCtrl'
      })
      .state('gwddcxdetails', {
        url: '/gwddcxdetails',
        templateUrl: 'templates/gwddcxdetails.html',
        controller: 'ddcxCtrl'
      })
      .state('zdchbd', {  //终端串号绑定
        url: '/zdchbd',
        templateUrl: 'templates/zdchbd.html',
        controller: 'zdchbdCtrl'
      })
      //.state('splash',{
      //  url:'/splash',
      //  templateUrl:'templates/splash.html',
      //  controller:'SplashCtrl'
      //})
      .state('ddcxywkhdetails',{
        url: '/ddcxywkhdetails',
        templateUrl: 'templates/ddcxywkhdetails.html',
        controller: 'ddcxCtrl'
      })
      .state('rzbd',{
        url: '/rzbd',
        templateUrl: 'templates/rzbd.html',
        controller: 'rzbdCtrl'
      })
    ;
    $urlRouterProvider.otherwise('/login');
  }
)
.filter('customCurrency', ['$filter', function ($filter) {
  return function(amount){
    var rst = $filter('currency').apply(this, arguments);
    return amount >= 0 ? rst : rst.replace('(', '-').replace(')', '')
  };
}]);
